﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Toto.Componentes
{
    class Boneco
    {
        Texture2D textura;

        public Texture2D bTextura
        {
            get { return this.textura; }
        }

        public Rectangle retangulo;

        public Rectangle hitBox;

        public int chute;

        public bool time;

        Vector2 posicao;

        public Vector2 Posicao
        {
            get { return this.posicao; }

            set { this.posicao = value; }
        }

        /// <summary>
        /// Construtor do Boneco.
        /// </summary>
        /// <param name="textura">Textura do boneco</param>
        /// <param name="posicao">Posição inicial do boneco</param>
        public Boneco(int tipoBoneco, Vector2 posicao, Rectangle retangulo)
        {
            if (tipoBoneco == 1)
            {
                this.textura = Textura.texturaBoneco;
                time = true;
            }
            else
            {
                this.textura = Textura.texturaBoneco2;
                time = false;
            }
            this.retangulo = retangulo;
            this.posicao = posicao;
            this.chute = 1;

            hitBox.Width = retangulo.Width;
            hitBox.Height = retangulo.Height;
        }

        public void Update(GameTime gameTime)
        {

            hitBox.X = (int)posicao.X;
            hitBox.Y = (int)posicao.Y;

        }

        public BoundingBox GetBounding()
        {
            return new BoundingBox(new Vector3(this.posicao.X, this.posicao.Y, 0),new Vector3(this.posicao.X + this.hitBox.Width, this.posicao.Y + this.hitBox.Height, 0));
        }

        /// <summary>
        /// Desenha o boneco na tela.
        /// </summary>
        /// <param name="spriteBatch">spriteBatch</param>
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(textura, posicao, retangulo, Color.White);
            //spriteBatch.Draw(textura, posicao, Color.White);
        }

    }
}
